#include <iostream>
#include <string>

//https://www.nowcoder.com/practice/b4525d1d84934cf280439aeecc36f4af?tpId=182&tqId=34752&ru=/exam/oj

class Solution
{
public:
    int getLongestPalindrome(string s)
    {
        int n = s.size();

        int ret = 0;
        for (int i = 0; i < n; i++)
        {
            int left = i - 1, right = i + 1;
            while (left >= 0 && right < n && s[left] == s[right])
            {
                left--;
                right++;
            }
            ret = max(ret, right - left - 1);

            left = i - 1, right = i;
            while (left >= 0 && right < n && s[left] == s[right])
            {
                left--;
                right++;
            }
            ret = max(ret, right - left - 1);
        }

        return ret;
    }
};

int main()
{
    return 0;
}